Not Applicable
1. Technical Field
This invention relates in general to computer systems and, more particularly, to a method and apparatus for a hardware cleaning function for a virtual index, virtual tag cache memory systems.
2. Description of the Related Art
Many multi-tasking computer systems make use of a virtual index, virtual tag (VIVT) cache memory architecture. Most computer systems, and in particular those systems embedded within portable solutions, are designed to support a high MIPS (millions of instructions per second) demand while maintaining power consumption at reasonable rates. Relatively small memory caches, accessed in a single processor cycle, allow a high level of performance while running with main memories at lower speed.
While, formerly, computer systems operated on a single application at one time, computer systems of today generally have several applications loaded into their main memories. The scheduling of multiple applications, running in parallel for the user, is managed by an operating system (OS). Most modern operating systems are designed with the concept of a virtual environment. Addresses coming from the processor are virtual address which map to actual (xe2x80x9cphysicalxe2x80x9d) addresses in main memory. Cache memories using virtual indices and virtual tags are the most efficient structures for a virtual environment.
For these multi-tasking systems, an important constraint is the context switch. The context switch corresponds to the necessary sequence of actions that the OS needs to execute in order to accommodate several independent tasks on a single processor. The context switch is a limiting factor on the performance in systems with strong real-time requirements, because it takes a significant time and number of instruction to realize the context switch.
Multitasking systems in a virtual environment must deal with xe2x80x9caliasingxe2x80x9d of data which can occur when two or more different tasks cache data associated with the same physical address at two or more respective locations in the cache in accordance with the different virtual addresses used by the various tasks. When one task changes the value associated with a cached data item, that change will not be reflected in the cache locations of other virtual addresses which pint to the same physical memory address. As part of a context switch, the operating system must invalidate the content of the cache so that other tasks will see the new value.
The cleaning function associated with invalidating the cache can be very time consuming. Further, the cleaning function may be interrupted only at discrete time intervals, depending upon the cache cleaning design. For many applications which have tight real-time constraints, it is important that interrupts be allowed frequently. However, cleaning routings which have capacity to allow interrupts at frequent intervals often are the least efficient in completing the cleaning operation.
Therefore, a need has arisen for a high efficiency method and apparatus for cleaning a VIVT cache system which allows frequent interrupts.
The present invention provides a method and apparatus for performing a cache clean function in a system with a cache memory and a main memory. Address circuitry outputs a series of cache addresses in a predetermined order within a range of potentially dirty cache addresses. Control logic circuitry writes information from cache addresses associated with the output from said address circuitry to corresponding main memory locations for each dirty cache location. The address circuitry may be enabled and disabled responsive to either the detection of an interrupt or upon completion of writing all dirty entries to the main memory, such that the clean function can continue by enabling said address circuitry after an interrupt.
The present invention provides significant advantages over the prior art. First, the invention has the benefit of the speed of a hardware cache instruction; after the initial invocation of the hardware clean operation, software is involved only if an interrupt occurs. Second, the hardware cleaning operation may be interrupted as it cycles through the cache entries, allowing the system to respond to interrupts as necessary for real-time requirements. Third, the number of cache entries is optimized to service only the range of cache entries which have associated dirty bits.